#define DEBUG
#include <cstdio>
#define MODS 1000000007
#define MAXS 16384
#define HASHES 1000033
#define MAXN 14

using namespace std;

class Hash {
public:
  unsigned long long key[HASHES], val[HASHES];
  bool book[HASHES];

  void ins(unsigned long long k, unsigned long long v) {
    int i=k%HASHES;
    for (; book[i]; i=i%HASHES+1);
    key[i] = k, val[i] = v, book[i]=true;
  }

  unsigned long long get(unsigned long long k) {
    int i=k%HASHES;
    for (; book[i]; i=i%HASHES+1) {
      if (key[i]==k) {
	return val[i];
      }
    }
    return -1;
  }
};


unsigned long long hash(int i, int j, int k, int l) {
  unsigned long long ret = ((i*100+j)*100000LU+k)*10000000000LU+l;
  return ret;
}

long long solve(int o, int p, int s, int dis, int n, int a[MAXN+1][MAXN+1]) {
  if (o==0) {
    if (p==1 && s==0 && dis==0) {
      return 1;
    } else {
      return 0;
    }
  }
  s = s-(1<<(p-1));
  if (o==1) {
    if (dis>=a[1][p]) {
      return solve(0, 1, s, dis-a[1][p], n, a);
    } else {
      return 0;
    }
  } 
  static Hash map;
  long long ret;
  if ((ret=map.get(hash(o, p, s, dis)))>=0) {
    return ret;
  }
  ret = 0;
  for (int i=1; i<=n; i++) {
    if ((s>>(i-1))&1 && dis>=a[i][p]) {
      ret = (ret+solve(o-1, i, s, dis-a[i][p], n, a))%MODS;
    }
  }
  map.ins(hash(o, p, s, dis), ret);
  return ret;
}

int main() {
  freopen("way.in", "r", stdin);
  freopen("way.out", "w", stdout);

  static int a[MAXN+1][MAXN+1];
  int n, l;
  scanf("%d %d", &n, &l);
  for (int i=1; i<=n; i++) {
    for (int j=1; j<=n; j++) {
      scanf("%d", &a[i][j]);
    }
  }

  printf("%lld\n", solve(n, 1, (1<<n)-1, l, n, a));

  fcloseall();
  return 0;
}
